# Create your views here.
from rest_framework.generics import ListAPIView
from .models import Car
from users.models import UserCart, UserCartDone, UserPinglun
from .serializers import CarModelSerializer
from users.serializers import UserCartModelSerializer, UserCartDoneModelSerializer, UserPinglunModelSerializer


class CarListAPIView(ListAPIView):
    queryset = Car.objects.filter(is_show=True, is_delete=False).order_by("id")
    serializer_class = CarModelSerializer


class UserCartListAPIView(ListAPIView):
    queryset = UserCart.objects.filter(is_show=True, is_delete=False).order_by("id")
    serializer_class = UserCartModelSerializer


class UserCartDoneListAPIView(ListAPIView):
    queryset = UserCartDone.objects.filter(is_show=True, is_delete=False).order_by("id")
    serializer_class = UserCartDoneModelSerializer


class UserPinglunListAPIView(ListAPIView):
    queryset = UserPinglun.objects.filter(is_show=True, is_delete=False).order_by("-id")
    serializer_class = UserPinglunModelSerializer
